<template>
  <div class='container'>
    <el-dialog
      title="题目审核"
      :visible.sync="dialogVisible"
      width="440px"
      :before-close="handleClose">
      <el-form ref="form" :model="form">
        <el-form-item>
          <el-radio-group v-model="form.chkState">
            <el-radio :label="1">通过</el-radio>
            <el-radio :label="2">拒绝</el-radio>
          </el-radio-group>
        </el-form-item>
        <el-form-item>
          <el-input type="textarea" v-model="form.chkRemarks" placeholder="请输入审核意见"></el-input>
        </el-form-item>
        <el-form-item>
          <div class="right">
            <el-button @click="resetForm">取消</el-button>
            <el-button type="primary" @click="onSubmit">确认</el-button>
          </div>
        </el-form-item>
      </el-form>
    </el-dialog>
  </div>
</template>

<script>
import { choiceCheck } from '@/api/hmmm/questions'
export default {
  name: 'QuestionsCheck',
  data () {
    return {
      dialogVisible: false,
      form: {
        id: '',
        chkState: 0,
        chkRemarks: ''
      }
    }
  },
  methods: {
    handleClose () {
      this.dialogVisible = false
      this.form = {
        chkState: 0,
        chkRemarks: ''
      }
    },
    resetForm () {
      this.handleClose()
    },
    async onSubmit () {
      await choiceCheck(this.form)
      this.$parent.getQuestionList()
      this.resetForm()
    }
  }
}
</script>

<style scoped lang='scss'>
  ::v-deep .el-dialog__body{
    padding-bottom: 1px;
    .el-textarea {
      textarea {
        width: 400px;
        height: 100px;
      }
    }
    .right {
      display: flex;
      justify-content: flex-end;
    }
  }
</style>
